//
//  ACProgressHUD.h
//  ACFramework
//
//  Created by caoyq on 2018/6/8.
//  Updated by caoyq on 2018/11/26.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, ACProgressHUDPosition)
{
    ACProgressHUDPositionMidden = 0,
    ACProgressHUDPositionTop,
    ACProgressHUDPositionBottom
};

/**
 * 针对 MBProgressHUD 的一个封装，使用起来更方便.
 *
 * 添加一个分类，解决HUD出现时，底部视图不能操作的问题.
 *
 * 采用单例记录图片和持续时间的值，一次设置全局生效，不设置则采用默认值.
 */
@interface ACProgressHUD : NSObject

/** success image. 不赋值则使用默认 */
@property (nonatomic, strong) UIImage *successImage;
/** error image. 不赋值则使用默认 */
@property (nonatomic, strong) UIImage *errorImage;
/** hud持续时间. 默认 1.2s */
@property (nonatomic, assign) CGFloat duration;
/** 默认HUD加载的view，就是当前的Window */
@property (nonatomic, strong) UIView *hudView;

///实例化
+ (instancetype)manager;

#pragma mark - HUD

///显示一个默认转圈的hud，需要主动取消才消失.
+ (void)showHUD;

/**
 在具体的view上 显示一个默认转圈的hud，需要主动取消才消失.
 
 默认是加载到UIWindow上

 @param toView 容器view
 */
+ (void)showHUDToView: (UIView *)toView;

+ (void)showHUDWithText: (NSString *)text;

+ (void)showHUDWithText: (NSString *)text ToView: (UIView *)toView;

+ (void)hideHUD;

+ (void)hideHUDFromView: (UIView *)fromView;

#pragma mark - text

+ (void)showText: (NSString *)text;

+ (void)showText: (NSString *)text toView: (UIView *)toView;

+ (void)showText:(NSString *)text position: (ACProgressHUDPosition)position;

+ (void)showText:(NSString *)text toView: (UIView *)toView position: (ACProgressHUDPosition)position;

#pragma mark - success

+ (void)showSuccessWithText: (NSString *)text;

+ (void)showSuccessWithText: (NSString *)text toView: (UIView *)toView;

#pragma mark - error

+ (void)showErrorWithText: (NSString *)text;

+ (void)showErrorWithText: (NSString *)text toView: (UIView *)toView;

@end
